<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="StarOffice 6.0  (Win32)">
	<META NAME="AUTHOR" CONTENT="Charu Chaubal">
	<META NAME="CREATED" CONTENT="20020801;9123934">
	<META NAME="CHANGEDBY" CONTENT="Charu Chaubal">
	<META NAME="CHANGED" CONTENT="20020801;9204301">
</HEAD>
<BODY LANG="en-US">
<H1>Rotating and truncating Sun Grid Engine Log Files</H1>
<P STYLE="margin-top: 0.42cm; page-break-after: avoid"><FONT FACE="Albany, sans-serif"><FONT SIZE=4>Contents</FONT></FONT></P>
<OL>
	<LI><P STYLE="margin-bottom: 0cm"><A HREF="#overview">Overview</A> 
	</P>
	<LI><P STYLE="margin-bottom: 0cm"><A HREF="#variables">Variables</A>
		</P>
	<LI><P STYLE="margin-bottom: 0cm"><A HREF="#parameters">Command line
	parameters</A> 
	</P>
	<LI><P><A HREF="#examples">Examples</A> 
	</P>
</OL>
<HR>
<H1><A NAME="overview"></A>Overview</H1>
<P>Sun Grid Engine daemons create log files called &quot;messages&quot;
in their respective spool directories. Also, an 'accounting' file and
a 'statistics' file is created. A script for truncating log files is
found in the following directory: 
</P>
<PRE STYLE="margin-left: 2cm; margin-bottom: 0.5cm">$SGE_ROOT/util/logchecker.sh</PRE><P>
The script is not activated by any of the Sun Grid Engine daemons
automatically. It is intended to be edited according to the needs of
your site. After customizing the script, you can add an entry to your
crontab. The script is can run in verbose mode or completely
silently. It can also run in a mode where it only prints what would
be done. The script accepts only two command line parameters for
overriding the <TT>ACTION_ON</TT> parameter and the location of the
exec daemon spool directory (see below). 
</P>
<P>Sun Grid Engine Software daemons create log files in the
<TT>qmaster_spool_dir</TT> and <TT>execd_spool_dir</TT> which are
defined in the global cluster configuration, the can be overridden in
the local cluster configuration of every execution host (usually this
is not done). The directory is usually called 'default', and only if
the <TT>$SGE_CELL</TT> variable is used, 'default' is overridden. 
</P>
<P>Default location of Sun Grid Engine log files: 
</P>
<PRE STYLE="margin-left: 2cm">&lt;qmaster_spool_dir&gt;/messages
&lt;qmaster_spool_dir&gt;/schedd/messages
&lt;execd_spool_dir&gt;/&lt;hostname&gt;/messages
&lt;sge_root&gt;/&lt;sge_cell&gt;/common/accounting
&lt;sge_root&gt;/&lt;sge_cell&gt;/common/statistics
  </PRE><P>
Since these directories can all be located in the same directory
hierarchy in a shared NFS filesystem, or the execd spool directories
can point to a local directory, it is possible to specify with the
<TT>ACTION_ON</TT> parameter (see below) which 'messages' files
should be rotated when the script is called. 
</P>
<HR>
<H1><A NAME="variables"></A>Variables</H1>
<P>The following variables need to be configured in the script. The
&quot;|&quot; character specifies an alternative. All variables in
the script must be entered in Bourne shell syntax. So there may be no
white space before or after the equal &quot;=&quot; sign. 
</P>
<UL>
	<LI><P><TT>UNCONFIGURED=yes|no</TT> 
	</P>
	<P>After the script is configured you should set this values to
	&quot;yes&quot;. If set to &quot;no&quot; (or any other value), the
	script only will print out what would be done. 
	</P>
	<P>Default: <TT>UNCONFIGURED=yes</TT> 
	</P>
	<LI><P><TT>ECHO=:|echo</TT> 
	</P>
	<P>The colon &quot;:&quot; is the null command in the shell. If you
	set the variable to this value, the script will work silently (only
	error messages are printed). If you set the value to &quot;echo&quot;
	the script will print what it is currently doing. 
	</P>
	<P>Default: <TT>ECHO=echo</TT> 
	</P>
	<LI><P><TT>SGE_ROOT=</TT> 
	</P>
	<P>Enter the path of your <TT>sge_ROOT</TT> directory here. 
	</P>
	<P>Default: <TT>SGE</TT><TT>_ROOT=undefined</TT> 
	</P>
	<LI><P><TT><TT>SGE</TT>_CELL=default|</TT> 
	</P>
	<P>Enter the name of your cell, if not 'default' 
	</P>
	<P>Default: <TT>SGE</TT><TT>_CELL=default</TT> 
	</P>
	<LI><P><TT>ACTION_ON=1|2|3|4</TT> 
	</P>
	<P>1 = work on qmaster and scheduler &quot;messages&quot; files
	only<BR>2 = work on &quot;messages&quot; file on current host only<BR>3
	= work on all accessible execd &quot;messages&quot; files of global
	config<BR>4 = work on qmaster &quot;messages&quot; and all
	accessible execd &quot;messages&quot; files</P>
	<P>Default: <TT>ACTION_ON=4</TT> 
	</P>
	<LI><P><TT>ACTIONSIZE=</TT> 
	</P>
	<P>rotate/delete only if file size exceeds <TT>ACTIONSIZE</TT> in
	kilobytes. If <TT>ACTIONSIZE</TT> is set to 0, rotate &quot;messages&quot;
	file each time script is called. 
	</P>
	<P>Default: <TT>ACTIONSIZE=0</TT> 
	</P>
	<LI><P><TT>KEEPOLD=</TT> 
	</P>
	<P>Defines the number of old messages files to be preserved. E.g.
	&quot;30&quot; means that &quot;messages.0&quot; to &quot;messages.29&quot;
	are saved. A value of &quot;0&quot; means no backup is done. The
	most recent messages file has the extension &quot;.0&quot;. 
	</P>
	<P>Default: <TT>KEEPOLD=30</TT> 
	</P>
	<LI><P><TT>GZIP=yes|no</TT> 
	</P>
	<P>yes = compress rotated &quot;messages.0&quot; file with <TT>gzip</TT><BR>no
	= leave rotated &quot;messages.0&quot; file uncompressed</P>
	<P>Default: <TT>GZIP=yes</TT> 
	</P>
	<LI><P><TT>ACCT=yes|no</TT> 
	</P>
	<P>yes = rotate accounting file when rotating qmaster 'messages'
	file<BR>no = don't rotate accounting file</P>
	<P>Default: <TT>ACCT=no</TT> 
	</P>
	<LI><P><TT>STAT=delete|yes|no</TT> 
	</P>
	<P>delete = delete statistics file<BR>yes = rotate statistics
	file<BR>no = don't rotate statistics file</P>
	<P>The 'statistics' file in this release is not used. You can safely
	delete it. you can also set the the parameter <TT>stat_log_time</TT>
	in your global cluster configuration to a very long interval
	(default is 48:00:00 - 48 hours) 
	</P>
	<P>Default: <TT>STAT=delete</TT> 
	</P>
</UL>
<HR>
<H1><A NAME="parameters"></A>Command line parameters</H1>
<P>The script accepts the following command line parameters: 
</P>
<UL>
	<LI><P><TT>-execd_spool </TT>
	</P>
	<P>Define the base directory of the <TT>execd</TT> spool directory.
	Do not add the unqualified hostname in the command line. The
	hostname is added automatically by the script. 
	</P>
	<LI><P><TT>-action_on 1|2|3|4</TT> 
	</P>
	<P>Override the <TT>ACTION_ON</TT> variable in the script. 
	</P>
</UL>
<HR>
<H1><A NAME="examples"></A>Examples</H1>
<OL TYPE=a>
	<LI><P>All Sun Grid Engine spool directories are shared. You can
	call the script on any one of your Sun Grid Engine hosts or on your
	file server. 
	</P>
	<BLOCKQUOTE><BR>set <TT>ACTION_ON</TT> to &quot;4&quot; in the
	script. Set other values according to your needs and add the script
	to your crontab of one of the above machines. 
	</BLOCKQUOTE>
	<LI><P>Sun Grid Engine execd spool are defined only through the
	global cluster configuration, but point to a local directory. 
	</P>
	<BLOCKQUOTE><BR>set <TT>ACTION_ON=&quot;3&quot;</TT>. Add the start
	of the script to all crontabs of your execds in your cluster. On
	your qmaster machine (or on your file server) add the following call
	of the script to your crontab: 
	</BLOCKQUOTE>
	<PRE STYLE="margin-right: 1cm; margin-bottom: 0.5cm">   &lt;path_to_script&gt;/logchecker.sh -action_on 1</PRE>
	<LI><P>Sun Grid Engine spool directories of execds are defined in
	the local configuration. 
	</P>
	<BLOCKQUOTE>Set <TT>ACTION_ON=&quot;2&quot;</TT> in the script:<BR><BR>On
	your qmaster machine (or on your file server) add the following call
	of the script to your crontab: 
	</BLOCKQUOTE>
	<PRE STYLE="margin-right: 1cm; margin-bottom: 0.5cm">   &lt;path_to_script&gt;/logchecker.sh -action_on 1</PRE><BLOCKQUOTE>
	On your exec hosts add the following line: 
	</BLOCKQUOTE>
	<PRE STYLE="margin-right: 1cm; margin-bottom: 0.5cm">   &lt;path_to_script&gt;/logchecker.sh -execd_spool </PRE>
</OL>
<P><BR><BR><BR><BR><BR>
</P>
</BODY>
</HTML>